/******************************************************************************************************
Copyright (C) 2008 Mestrelab Research S.L. All rights reserved.

This file is part of the MNova scripting toolkit.

Authorized users of MNova Software may use this file freely, but this file is provided AS IS
with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.
*****************************************************************************************************/

// This function adds two named text fields to the current page in the current document.
// It is intended as an example on how to add custom fields to a layout document for later storage in MnDB.
// The field contents can be retrieved by setting the field content definition accordingly when creating the
// database, e.g.: '=getNamedTextField("Field", "[ProjectName]")'.
// The function getNamedTextField(aType, aSubtype) is defined in DBPlugin.qs.

function addNamedFields()
{
        var w = new DocumentWindow(mainWindow.activeWindow());
        var p = new Page(w.curPage());

        var label1 = draw.text("Project Name:", false);
        label1.translate(0, 40);
        label1.width = 50;

        var field1 = draw.text("( Fill in project name )", "Field", "[ProjectName]", false);
        field1.translate(50, 40);
        field1.width = 90;
        field1.color="lightgray";
        field1.opacity=30;
        
        var label2 = draw.text("Analysis Comments:", false);
        label2.translate(0,60);
        label2.width=50;

        var field2 = draw.text("( Fill in analysis comments )", "Field", "[Comments]", false);
        field2.translate(50, 60);
        field2.width = 90;
        field2.height =100;
        field2.color="lightgray";
        field2.opacity=30;

        w.update();
}
